//    Copyright (C) Kherty.  All rights reserved.
using System;
using System.Collections;

namespace OpenLS.Chart.Internals
{
    internal class StackedDisplayInformation : INumericChartDisplayInformation
    {
        private readonly int maxIndex;

        public StackedDisplayInformation(IEnumerable series)
        {
            foreach (Series s in series)
            {
                foreach (NumericValue value in ((INumericValuesProvider) s).GetValues())
                {
                    maxIndex = Math.Max(maxIndex, value.Index);
                }
            }
        }

        #region INumericChartDisplayInformation Members

        public int Count
        {
            get { return maxIndex + 1; }
        }

        #endregion
    }
}